// import packages
import { setUserToken, removeUserToken } from "@/common/utils";

/* --------------------------------------------------------------
 *                          User Store
 * -------------------------------------------------------------- */

/**
 * User state info
 * @typedef {Object} UserState
 */
const state = {
    token: "",
}

/**
 * User mutations
 * @typedef {Object} UserMutations
 */
const mutations = {
    // Set token
    setToken(state, token) {
        state.token = token;
        setUserToken(token);
    },

    // Delete token
    delToken(state) {
        state.token = "";
        removeUserToken();
    },
}

const user = { 
  namespaced: true,
  state,
  mutations,
};

export default user;